home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- // Copyright (C) 2000 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Date
- // Author: jdc rendering
- //
- // Description:
- //
- // description
- //
-
- source clipMenuCommands.mel;
-
- //---------------------------------------------------------------------------
- // The procedure which builds the menu
- //
- global proc buildHypergraphNodePopupMenuItems(
- string $hypershade,
- string $node)
- {
- //
- // Description:
- // This procedure is called when the user RMB clicks on a node in a scene
- // or graph tab hypershade editor.
- // This procedure builds the menu items which will appear in the popup
- // menu.
- // The popup menu this procedure generates can vary depending on the
- // type of the node under the cursor.
- //
-
- string $nodeType = `nodeType $node`;
-
- if ($nodeType == "place3dTexture")
- {
- menuItem
- -label "Fit to Group Bounding Box"
- -command ("source AEplace3dTextureTemplate.mel; " +
- "PSfitPlacementToGroup " + $node);
-
- string $selection[] = `ls -sl`;
-
- if (size($selection) > 0)
- {
- string $leadSelectionItem = $selection[0];
- menuItem
- -label
- ("Parent Placement to Selection ("
- + $leadSelectionItem
- + ")")
- -command ("parent " + $node + " " + $leadSelectionItem);
- }
- else
- {
- menuItem
- -label "Parent Placement to Selection"
- -enable false;
- }
- }
- else if (isClassified($node, "shader"))
- {
- string $shadingGroupArray[] =
- `listConnections
- -source false
- -destination true
- -type "shadingEngine"
- $node`;
- int $isOceanShader = nodeType( $node ) == "oceanShader";
- int $groupSize = size($shadingGroupArray);
- if( $groupSize == 2 && $isOceanShader){
- // OceanShaders are assigned twice to the same group:
- // once for displacement and once for surfaceShading.
- // Thus we get two identical groups, while we wish to display
- // just one.
- if( $shadingGroupArray[0] == $shadingGroupArray[1] ){
- $groupSize = 1; // force use of "assign material"
- }
- }
-
- if ( $groupSize <= 1)
- {
- if( $isOceanShader )
- {
- menuItem
- -label "Assign Material To Selection"
- -command ("assignOceanShader " + $node);
- }
- else
- {
- menuItem
- -label "Assign Material To Selection"
- -command ("hyperShade -assign " + $node);
- }
- menuItem -divider true;
- menuItem
- -label "Select Objects With Material"
- -command ("hyperShade -objects " + $node);
- menuItem
- -label "Frame Objects With Material"
- -command
- ("hyperShade -objects "
- + $node
- + ";fitAllPanels -selected");
- }
- else
- {
- int $i;
-
- for ($i = 0; $i < size($shadingGroupArray); $i++)
- {
- menuItem
- -label ("Assign "+ $shadingGroupArray[$i] +" To Selection")
- -command ("hyperShade -assign " + $shadingGroupArray[$i]);
- }
- menuItem -divider true;
-
- for ($i = 0; $i < size($shadingGroupArray); $i++)
- {
- menuItem
- -label ("Select Objects in " + $shadingGroupArray[$i])
- -command ("hyperShade -objects " + $shadingGroupArray[$i]);
- menuItem
- -label ("Frame Objects in " + $shadingGroupArray[$i])
- -command
- ("hyperShade -objects "
- + $shadingGroupArray[$i]
- + ";fitAllPanels -selected");
- }
- }
- menuItem -divider true;
- }
- else if (isClassified($node, "texture"))
- {
- menuItem
- -label "Assign Texture's Material to Selection"
- -command
- ("hypergraphAssignTextureToSelection " + $node);
-
- if ($nodeType == "file")
- {
- menuItem
- -label "Reload Image File"
- -command
- ("string $name=`getAttr "
- + $node
- + ".fileTextureName`;"
- + "setAttr "
- + $node
- + ".fileTextureName "
- + "-type \"string\" $name;");
- }
- menuItem -divider true;
- }
- else if (isClassified($node, "light"))
- {
- menuItem
- -label "Make Links with Selected Objects"
- -command ("lightlink -make -light "+$node+" -useActiveObjects");
-
- menuItem
- -label "Break Links with Selected Objects"
- -command ("lightlink -break -light "+$node+" -useActiveObjects");
-
- menuItem -divider true;
-
- menuItem
- -label "Select Objects Illuminated by Light"
- -command ("selectObjectsIlluminatedBy "+$node);
-
- menuItem
- -label "Frame Objects Illuminated by Light"
- -command ("selectObjectsIlluminatedBy "+$node+"; fitAllPanels -selected");
-
- menuItem -divider true;
- }
- else if ($nodeType == "textureBakeSet" || $nodeType == "vertexBakeSet" )
- {
- menuItem
- -label "Assign Selection To Bake Set"
- -command ("sets -forceElement " + $node + " `ls -dag -objectsOnly -geometry -selection`" );
- menuItem -divider true;
- menuItem
- -label "Select Objects In Bake Set"
- -command ("select " + $node);
- menuItem
- -label "Frame Objects In Bake Set"
- -command
- ("select " + $node + " ;fitAllPanels -selected");
-
- menuItem -divider true;
- }
- else if ($nodeType == "animClip")
- {
- menuItem
- -label "Copy"
- -annotation "Copy Clip (to be pasted in TraX Window)"
- -command ("clipCopyMenuCommand " + $node)
- ClipCopyItem;
- menuItem
- -label "Instance"
- -annotation "Instance Clip at Current Time"
- -command ("clipInstanceMenuCommand " + $node)
- ClipInstanceItem;
- menuItem
- -label "Duplicate"
- -annotation "Duplicate Clip"
- -command ("clipDuplicateMenuCommand " + $node)
- ClipDuplicateItem;
- menuItem
- -label "Export"
- -annotation "Export Clip"
- -command ("doExportClipArgList 2 { \"\", \"" + $node + "\"}")
- ClipExportItem;
- menuItem -divider true;
- menuItem
- -label "Apply Pose"
- -annotation "Move Character to Saved Pose or Clip Start"
- -command ("clipApplyPoseMenuCommand " + $node)
- ClipApplyPoseItem;
- menuItem -divider true;
- }
-
- menuItem
- -label "Select Input Nodes"
- -command ("select -noExpand `listHistory " + $node + "`")
- -annotation "Select all nodes input to this node";
- menuItem
- -label "Select Output Nodes"
- -command
- ("select -noExpand `listHistory -future true "
- + $node
- + "`")
- -annotation "Select all nodes output from this node";
-
- menuItem -divider true;
-
- menuItem
- -label "Attribute Editor..."
- -command
- ("hyperGraph -e -attributeEditor single -useFeedbackList "
- + $hypershade);
- menuItem
- -label "Rename"
- -command
- ("hyperGraph -e -rename -useFeedbackList " + $hypershade);
- }
-